﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Resto.CostControl.Core.Domain.Model;

namespace Resto.CostControl.Core.Facade.SiteModule.DataTransferObject
{
    /// <summary>
    /// 菜肴销售情况
    /// </summary>
    public class SaleStatusDTO
    {
        #region 基本属性

        public string ID { get; set; }

        /// <summary>
        /// 生产数量
        /// </summary>
        public int ProduceCount { get; set; }

        /// <summary>
        /// 销售数量
        /// </summary>
        public int SaleCount { get; set; }

        /// <summary>
        /// 剩余数量
        /// </summary>
        public int RemainCount
        {
            get
            {
                return ProduceCount - SaleCount;
            }
        }

        /// <summary>
        /// 菜肴ID,可为空
        /// </summary>
        public string DishID { get; set; }

        /// <summary>
        /// 菜肴名称
        /// </summary>
        public string DishName { get; set; }

        #endregion

        #region 构造函数

        public SaleStatusDTO() { }

        internal SaleStatusDTO(SaleStatus item)
        {
            this.ID = item.ID;
            this.DishID = item.DishID;
            this.DishName = item.DishName;
            this.ProduceCount = item.ProduceCount;
            this.SaleCount = item.SaleCount;
        }

        #endregion


        #region 方法

        internal SaleStatus ToSaleStatus()
        {
            SaleStatus item = new SaleStatus();
            CopyToSaleStatus(item);
            return item;
        }

        internal void CopyToSaleStatus(SaleStatus item)
        {
            item.DishID = this.DishID;
            item.DishName = this.DishName;
            item.ProduceCount = this.ProduceCount;
            item.SaleCount = this.SaleCount;
        }

        #endregion
    }
}
